﻿using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using PresenterNamespace;
using LoggerNamespace;

namespace View
{
    public partial class View : Form, IView
    {
        Presenter presenter;

        public string result 
        {
            get
            {
                return this.resultRichTextBox.Text;
            }
            set 
            {
                this.resultRichTextBox.Text = value;
            } 
        }
        public string addField 
        {
            get
            {
                return this.addTextBox.Text;
            }
            set
            {
                this.addTextBox.Text = value;
            }
        }

        public void showLog(String str)
        {
            LogView logView = new LogView(str);
            logView.Show();
        }

        public View()
        {
            InitializeComponent();
            presenter = new Presenter((IView)this,(ILogger)(new TextLogger()));
        }

        private void addButton_Click(object sender, EventArgs e)
        {
            presenter.addElement();
        }

        private void getButton_Click(object sender, EventArgs e)
        {
            presenter.getElement();
        }

        private void showLogButton_Click(object sender, EventArgs e)
        {
            presenter.showLog();
        }
    }
}
